﻿using Faser_VoteSys.Models.Database;
using Microsoft.AspNetCore.Mvc;
using System.Linq;

namespace Faser_VoteSys.Services
{
    public class UserService
    {
        private readonly Faser_VoteSysContext _db;

        public UserService(Faser_VoteSysContext db)
        {
            _db = db;
        }

        public User GetUserById(int id)
        {
            return _db.Users.FirstOrDefault(x => x.UserId == id);
        }

        public User GetUserByEmil(string email)
        {
            return _db.Users.FirstOrDefault(x => x.Email == email);
        }



    }
}
